do
  function setType(parent)
    parent:setType("gunner");
  end
  
  
  function update(parent)
    local itr = parent:getBounties():iterator();
    local worth = parent:getWorth();
    local ratio = 0;
    while itr:hasNext() do
      local element = itr:next();
      local value = element:getValue();
      local typet = element:getType();
      local x = parent:getX();
      local y = parent:getY();
      local dist = element:getDist(x,y);
      
      
      ratio = value/worth;
      
      if ratio >= 1 then
        if typet == 0 then
          local ex = element:getX();
          local ey = element:getY();
          local cur = parent:getCuriousity()*ratio;
          parent:move(ex,ey,cur);
          return;
        elseif typet == 1 then
          local ex = element:getX();
          local ey = element:getY();
          local cur = parent:getCuriousity()*ratio;
          parent:run(ex,ey,cur);
          return;
        else
          local ex = element:getAttachedX();
          local ey = element:getAttachedY();
          local brave = parent:getBravery()*ratio;
          parent:attack(ex,ey,brave);
          return;
        end
        
      end
      
    end
  
  end
  
  
  
  setType();
  update();
end